package com.wjk.kylin.mall.common.web.util;

import com.wjk.kylin.mall.common.core.dto.base.SessionUserDTO;

public class SysSession {
    private static final ThreadLocal<String> THREAD_LOCAL = new ThreadLocal<>();
    private static final ThreadLocal<SessionUserDTO> USER_DTO_THREAD_LOCAL = new ThreadLocal<>();


    public SysSession() {
    }

    public static String getTraceId() {
        return THREAD_LOCAL.get();
    }

    public static void setTraceId(String traceId) {
        THREAD_LOCAL.set(traceId);
    }

    public static void removeTraceId() {
        THREAD_LOCAL.remove();
    }


    public static SessionUserDTO getSessionUser(){
       return USER_DTO_THREAD_LOCAL.get();
    }

    public static void setSessionUser(SessionUserDTO dto){
        USER_DTO_THREAD_LOCAL.set(dto);
    }

    public static void removeSessionUser() {
        USER_DTO_THREAD_LOCAL.remove();
    }

}
